package com.app.shortvideo.startup

import android.content.Context
import com.app.shortvideo.BuildConfig
import com.app.shortvideo.MApplication
import com.app.shortvideo.config.Constant
import com.app.shortvideo.widget.MLoadMoreView
import com.app.library.utils.openId.OpenUDID_manager
import com.blankj.utilcode.util.CrashUtils
import com.blankj.utilcode.util.LogUtils
import com.chad.library.adapter.base.module.LoadMoreModuleConfig
import com.hjq.toast.Toaster
import com.rousetime.android_startup.AndroidStartup

class SecondStartUp: AndroidStartup<Boolean>() {
    override fun create(context: Context): Boolean? {
        LogUtils.getConfig().isLogSwitch = BuildConfig.LOG_DEBUG
        if (!OpenUDID_manager.isInitialized()) {
            OpenUDID_manager.sync(MApplication.mInstance)
        }
        if (BuildConfig.LOG_DEBUG) {
            CrashUtils.init(Constant.getCacheDirPath())
        }
        LoadMoreModuleConfig.defLoadMoreView = MLoadMoreView()
        // 初始化 Toast 框架
        Toaster.init(MApplication.mInstance)
        return true
    }

    override fun callCreateOnMainThread(): Boolean {
        return true
    }

    override fun waitOnMainThread(): Boolean {
        return false
    }
}